﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace T.FAS.Runtime.Metadata.Entity
{
    public class MetaDataCheckOut
    {
        public string ID { get; set; }
        public string MetaDataID { get; set; }
        public string MetaDataCode { get; set; }
        public string ProjectBranchID { get; set; }
        public string MetaDataVersionID { get; set; }
        public string MetaDataContent { get; set; }
        /// <summary>
        /// 0 正常，-1已删除
        /// 1 元数据新建、 5 元数据删除中
        /// 0、1、5都是待签入
        /// </summary>
        public int CheckOutState { get; set; }
        public string CheckOutUserID { get; set; }
        public string CheckOutUserName { get; set; }
        public string Description { get; set; }
        public string Creator { get; set; }
        public DateTime CreateTime { get; set; }
        public string LastModifier { get; set; }
        public DateTime LastModifyTime { get; set; } 
        public string MetaTypeID { get; set; }

        public List<MetaDataCheckOut> children { get; set; }

        //public TMetadata MetaData { get {
        //        return JsonConvert.DeserializeObject<TMetadata>(this.MetaDataContent, CreateMetaDtaJsonSeriaSetting());
        //} }
        //public string MetaTypeID { get { return this.MetaData.MetaTypeID; } }
        //public string MetaDataName { get {  return this.MetaData.Name;  } }

        //private static JsonSerializerSettings CreateMetaDtaJsonSeriaSetting()
        //{
        //    var jsonResolver = new Base.Entity.PropertyRenameAndIgnoreSerializerContractResolver();
        //    jsonResolver.IgnoreProperty(typeof(TMetadata), "content");
        //    jsonResolver.IgnoreProperty(typeof(TMetadata), "Content");
        //    jsonResolver.IgnoreProperty(typeof(TMetadata), "RefSchema");
        //    jsonResolver.IgnoreProperty(typeof(TMetadata), "CurrSchemaEnitty");
        //    jsonResolver.IgnoreProperty(typeof(TMetadata), "CheckOutMetaData");
        //    var serializerSettings = new JsonSerializerSettings();
        //    serializerSettings.ContractResolver = jsonResolver;
        //    return serializerSettings;
        //}
    }

}
